package com.societyGames.flashForms
{
import flash.display.Sprite;

public class Curtain extends Sprite
{
  private var _color:uint;
  private var _desiredWidth:Number = 0;
  private var _desiredHeight:Number = 0;

  public function get color():uint
  {
    return this._color;
  }

  public function set color(value:uint):void
  {
    if (this._color != value)
    {
      this._color = value;
      refresh();
    }
  }

  public override function set width(value:Number):void
  {
    if (this._desiredWidth != value)
    {
      this._desiredWidth = value;
      refresh();
    }
  }

  public override function set height(value:Number):void
  {
    if (this._desiredHeight != value)
    {
      this._desiredHeight = value;
      refresh();
    }
  }

  private function refresh():void
  {
    if (!isNaN(this._desiredWidth) && !isNaN(this._desiredHeight))
    {
      this.graphics.clear();
      this.graphics.beginFill(this._color, 1.0);
      this.graphics.drawRect(0, 0, this._desiredWidth, this._desiredHeight);
    }
  }
}
}